let arr1: [number, string] = [1, "1"]

let arr: number[] = [1, 1]

let add = function (a: (number | string), b: (number | string)) {

}

add(1, 2)
// add(1,"2")

function add1(x: (number | string)) {
  if ((x as string).length) {
    return (<string>x).length
  } else {
    return x.toString().length
  }
}

add1(1122)
add1("123444")